package edu.hawaii.solardecathlon.page.energy;

import java.util.Arrays;
import java.util.List;
import org.apache.wicket.ResourceReference;
import org.apache.wicket.markup.html.form.DropDownChoice;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.image.Image;
import edu.hawaii.solardecathlon.page.BasePage;
import edu.hawaii.solardecathlon.page.ExternalImageUrl;

/**
 * The application energy page.
 * 
 * @author Arthur Lee
 */
public class EnergyPage extends BasePage {

  /** Support serialization. */
  private static final long serialVersionUID = 1L;

  /**
   * The energy page for this application.
   */
  public EnergyPage() {
    // Add images for the different types of buttons per category.
    add(new Image("CoolingButton", new ResourceReference(EnergyPage.class,
        "../images/coolingredsmall.png")));
    add(new Image("OutletButton", new ResourceReference(EnergyPage.class,
        "../images/outletgreensmall.png")));
    add(new Image("HeatingButton", new ResourceReference(EnergyPage.class,
        "../images/heateryellowsmall.png")));
    add(new Image("LightingButton", new ResourceReference(EnergyPage.class,
        "../images/lightinggreensmall.png")));

    // Add a drop down box to categorize data by three types.
    Form<String> form = new Form<String>("form");
    List<String> viewData =
        Arrays.asList(new String[] { "Individually", "Categorically", "By Rooms" });
    form.add(new DropDownChoice<String>("Data", viewData));
    add(form);

    // Add a chart based on the type specified by user.
    String link =
        "http://chart.apis.google.com/chart?chxl=1:|Lighting|Heating|Outlet+7|"
            + "Outlet+6|Outlet+5|Outlet+4|Outlet+3|Outlet+2|Outlet+1|Cooling"
            + "&chxp=1,4.5,14.5,24.5,34.5,44.5,54.5,64.5,74.5,84.5,94.5&chxr=0,0,8&chxt=x,y&chbh=a"
            + "&chs=600x400&cht=bhs&chco=008000&chds=0,8"
            + "&chd=t:6.11,0.27,0.23,0.32,0.41,0.42,0.31,0.19,4.32,3.75&chm=h,FF0000,0,0.75:8,1";
    add(new ExternalImageUrl("BarChart", link));

  }
}
